package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author stone
 * @date 2021/11/30 21:40
 */
@RestController
@RequestMapping("admin/storage")
public class FileController {

    @Value("${upload.path}")
    String path;
    @RequestMapping("create")
    public BaseRespVo creat(MultipartFile file) throws IOException {
        File destFile = new File(path, "banner.png");
        file.transferTo(destFile);
        return BaseRespVo.ok(null);
    }
}
